package main;
import java.awt.geom.Point2D;
/**
 *
 * @author hide1713
 *
 */
public interface ICollider {
    /**
     * Return the max point of collider.
     * @return max point
     */
    Point2D getMax();
    /**
     * Return the min point of collider.
     * @return min point
     */
    Point2D getMin();
    /**
     * Set object speed.
     * @param speed of object
     */
    void setSpeed(Point2D speed);
    /**
     * Get current speed.
     * @return speed
     */
    Point2D getSpeed();
    /**
     * Handle collision situation. This function is always called by faster
     * object.
     * @param hitBy is the collide object.
     * @return true if the object needs to restore last position
     */
    boolean onHit(ICollider hitBy);
    /**
     * According to object speed, calculate next position.
     * @param timeDelta is the time elapsed from last frame. In millisecond.
     * @return the next position.
     */
    Point2D calculateNextPosition(float timeDelta);
    /**
     * Get current object position.
     * @return current position.
     */
    Point2D getPosition();
    /**
     * Set object position.
     * @param pos of object
     */
    void setPosition(Point2D pos);
    /**
     * Save the position before collision.
     */
    void saveLastPosition();
    /**
     * Reset the position back to previous position before collision.
     * @return
     */
    void restoreLastPosition();
}
